package com.huilian.cloud.module.test.order.mq;

import com.huilian.cloud.module.test.order.entity.Order;
import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;


@Slf4j
@Component
public class StockConsumer {


    @KafkaListener(topics = Order.TOPIC, // 重点：添加 @KafkaListener 注解，实现消息的消费
            groupId = Order.TOPIC + "_CONSUMER")
    public void onMessage(Order order) {
        log.info("收到的订单信息:{}", order);
        // TODO 锁定库存改为已售库存
    }

}
